package com.sduept.nwld.dataview.vo.fault;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

/**
 * 故障源统计分析模型对象，完成调管单位或者运维单位的报送率页面展示
 * @author laiy
 * @Date 2019年6月19日
 */
public class FaultSourceCountVO implements Serializable{

	/**
	 * 
	 */
	private static final long serialVersionUID = 2515823349865739792L;
	
	/**
	 *	统计的类型 ,（故障录波，保护录波，保护报文等）
	 */
	private String type;
	
	/**
	 * 调管单位或者运维单位上送率
	 */
	private List<UnitCountInfo>  units = new ArrayList<>();
	
	private UnitCountInfo total;
	
	
	/**
	 * 上送率结构体
	 */
	public class UnitCountInfo{
		public UnitCountInfo() {
			
		}
		
		/**
		 * 单位名称
		 */
		private String name;
		
		/**
		 * 应报次数
		 */
		private int targetTotal ;
		
		/**
		 * 自动上报次数
		 */
		private int automatic;
		
		/**
		 * 人工上报次数
		 */
		private int manual;
		
		/**
		 * 综合上报次数（自动+人工）
		 */
		private int upTotal;
		
		/**
		 * 上送率
		 */
		private double uploadRatio;
		
		/**
		 * 上送类型
		 */
		private String waveType;
		
		public String getName() {
			return name;
		}

		public void setName(String name) {
			this.name = name;
		}

		public int getTargetTotal() {
			return targetTotal;
		}

		public void setTargetTotal(int targetTotal) {
			this.targetTotal = targetTotal;
		}

		public int getAutomatic() {
			return automatic;
		}

		public void setAutomatic(int automatic) {
			this.automatic = automatic;
		}

		public int getManual() {
			return manual;
		}

		public void setManual(int manual) {
			this.manual = manual;
		}

		public int getUpTotal() {
			upTotal = manual+automatic;
			return upTotal;
		}
		
		public void setUpTotal(int manual, int automatic) {
			this.upTotal = manual+automatic;
		}

		public double getUploadRatio() {
			return uploadRatio;
		}

		public void setUploadRatio(int upTotal, int targetTotal) {
			double result = 0d;
			if(0 != targetTotal) {
				result = new BigDecimal((float)upTotal / targetTotal * 100).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
			}
			this.uploadRatio = result;
		}

		public String getWaveType() {
			return waveType;
		}

		public void setWaveType(String waveType) {
			this.waveType = waveType;
		}

	}


	public String getType() {
		return type;
	}



	public void setType(String type) {
		this.type = type;
	}



	public List<UnitCountInfo> getUnits() {
		return units;
	}



	public void setUnits(List<UnitCountInfo> units) {
		this.units = units;
	}



	public UnitCountInfo getTotal() {
		return total;
	}



	public void setTotal(UnitCountInfo total) {
		this.total = total;
	}
}
